package 游游的水果大礼包;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long m = in.nextLong();
        long a = in.nextLong();
        long b = in.nextLong();
        long res = 0;
        for (int i = 0; i <= Math.min(n / 2, m); i++) {
            long j = Math.min(n - 2 * i, (m - i) / 2);
            res = Math.max(res, a * i + b * j);
        }

        System.out.println(res);
    }
}
